#include "battery.h"

Battery::Battery() {
    _batteryParams = "24V/15Ah";
    _supplyVoltage = 24.0;
    _chargingTime = 2.0;
}

void Battery::print() {
    cout << "Battery: " << endl;
    cout << "\t batteryParams:" << _batteryParams << endl;
    cout << "\t supplyVoltage:" << _supplyVoltage << " V " << endl;
    cout << "\t chargingTime:" << _chargingTime << " h " << endl;
}

int Battery::save(YAML::Node& node) {
    node["Battery"] = YAML::Node(YAML::NodeType::Map);
    node["Battery"]["batteryParams"] = _batteryParams;
    node["Battery"]["supplyVoltage"] = _supplyVoltage;
    node["Battery"]["chargingTime"] = _chargingTime;
    return 0;
}

int Battery::setBatteryParams(std::string params) {
    _batteryParams = params;
    return 0;
}

void Battery::setSupplyVoltage(float voltage) {
    _supplyVoltage = voltage;
}

void Battery::setChargingTime(float time) {
    _chargingTime = time;
}
